/**  
  -- The Performance Driven Lime Project -- 

  A self adaptive tuple space for mobile agents and hosts by dynamic
  adapting tuple's replication policy.
  
  Copyright (C) 2008
  Xing Jiankuan, Pan Wenhui
  SAGroup of Tsinghua University

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received this copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 */
package sagroup.dracots;


/**
 * Defines various (static) constants. Please note that static initialization
 * occurs only if it is necessary: these values are initialized as soon as they
 * are required.
 * 
 * @author Xing Jiankuan
 * 
 */
public class DracoConstants {

	// The constants which describe the position of the "system
	// information" fields within a versionfied tuple are not in
	// this file because they are auto generated to TVRWrapper.
	public static final long INITIAL_VER_NUM = 1L;
	public static final long INVALID_VER_NUM = -1L;

	// Positions of draco tuple fields. This field does not contain LimeTuple
	// fields.
	public static final int TYPE_TAG = 0;
	public static final int VID_TAG = 1;
	public static final int CLZ_TAG = 2;
	public static final int DRACO_TAGS_NUMBER = 3;

	// Positions of share tuple fields.
	public static final int VER_TAG = 0 + DRACO_TAGS_NUMBER;
	public static final int MASTER_CURR_TAG = 1 + DRACO_TAGS_NUMBER;
	public static final int MASTER_DEST_TAG = 2 + DRACO_TAGS_NUMBER;
	public static final int IS_REPLICA_TAG = 3 + DRACO_TAGS_NUMBER;
	public static final int SHARE_TAGS_NUMBER = 4;
	public static final int SHARE_TOTAL_TAGS_NUMBER = DRACO_TAGS_NUMBER
			+ SHARE_TAGS_NUMBER;

	// Positions of fields of signal fields
	public static final int SRC_TAG = 0 + DRACO_TAGS_NUMBER;
	public static final int SIGNAL_TAGS_NUMBER = 1;
	public static final int SIGNAL_TOTAL_TAGS_NUMBER = DRACO_TAGS_NUMBER
			+ SIGNAL_TAGS_NUMBER;
	

	//Default upper bound of local replica capacity
	public static final long DEFAULT_REPLICA_MAX_CAPACITY = 1024 * 1024 * 2000; //20M bytes
	
	// Params for policy decision
	public static final int ADAPTIVE_CACULATION_RANGE = 5;
	
	public static final long ADAPTATION_PERIOD = 1000 * 30;
	
	public static final String LOGGING_CONFIGURATION = "logging.properties";
	public static final int RTUP_CACULATION_RANGE = 3;
	public static double THRES_RC = 0.4;
	public static double THRES_FR = 0.75;
	
	public static final DracoTuple[] EMPTY_DRACOTUPLE_ARR = new DracoTuple[0];
	public static final Double THRES_REP = 0.6;
	public static final Double THRES_SO = 0.4;
	
	// This is the allowable MSE for policy switch
	public static final Double THRES_MSE = 0.1;
}